package com.ruantu.clothing.util;

import java.math.BigInteger;
import java.security.MessageDigest;

public class MD5 {
    /**
     * @param key
     * @return
     */
    public static String d5(String key) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(key.getBytes());
            String str = new BigInteger(1, md.digest()).toString(16);
            return str;
        } catch (Exception e) {
        }
        return null;
    }

    /**
     * md5封裝
     *
     * @param pwd
     * @return
     */
    public static String password(String pwd) {
        return d5(d5(pwd + "ruantu"));
    }

}
